package com.bjsxt.controller;

import com.bjsxt.pojo.PageA;
import com.bjsxt.pojo.Role;
import com.bjsxt.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/role")
public class RoleController {

    @Autowired
    private RoleService  roleService;

    //查询所有角色的实现
    @RequestMapping("/findAll2")
    public   List<Role>   findAll2(){
        return  roleService.findAll2();
    }


    //修改角色操作
    @RequestMapping("/changeRole")
    public   Integer   changeRole(Role role,Integer [] mids){
       return   roleService.change(role,mids);
    }

    //查询指定角色下菜单实现
    @RequestMapping("/findMoreRM")
    public List<Integer>  findMoreRM(Integer rid){

        return  roleService.findMoreRM(rid);
    }


    //添加角色实现
    @RequestMapping("/saveRole")
    public  Integer   saveRole(Role role,Integer[] mids){

        return   roleService.save(role,mids);
    }

    @RequestMapping("/findAllRole")
    public PageA<Role>  findAllRole(Integer page,Integer rows){

        return  roleService.findAll(page, rows);
    }

}
